home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Graphics Programming (2nd Edition) / Visual Basic Graphics Programming 2nd Edition.iso / OldSrc / CH7 / SRC / OBJ1CIRC.CLS < prev    next >
Encoding:
Text File  |  1995-10-26  |  1.4 KB  |  52 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "ObjCircle"
  6. Attribute VB_Creatable = False
  7. Attribute VB_Exposed = False
  8. Option Explicit
  9.  
  10. Public x As Single
  11. Public y As Single
  12. Public r As Single
  13.  
  14. Function ObjectType() As String
  15.     ObjectType = "CIRCLE"
  16. End Function
  17.  
  18. ' ************************************************
  19. ' Compute the world coordinate bounds for the
  20. ' circle.
  21. ' ************************************************
  22. Sub Bound(xmin As Single, ymin As Single, xmax As Single, ymax As Single)
  23.     xmin = x - r
  24.     xmax = x + r
  25.     ymin = y - r
  26.     ymax = y + r
  27. End Sub
  28.  
  29. ' ************************************************
  30. ' Write a circle to a file using Write.
  31. ' Begin with "CIRCLE" to identify this object.
  32. ' ************************************************
  33. Sub FileWrite(filenum As Integer)
  34.     Write #filenum, "CIRCLE", x, y, r
  35. End Sub
  36. ' ************************************************
  37. ' Draw the circle on a Form, Printer, or
  38. ' PictureBox.
  39. ' ************************************************
  40. Sub Draw(canvas As Object)
  41.     canvas.Circle (x, y), r
  42. End Sub
  43.  
  44. ' ************************************************
  45. ' Read a circle from a file using Input.
  46. ' Assume the "CIRCLE" label has already been read.
  47. ' ************************************************
  48. Sub FileInput(filenum As Integer)
  49.     Input #filenum, x, y, r
  50. End Sub
  51.  
  52.